<template>
  <div>
    <Row :space="9">
      <Cell width="12">
        <div class="h-panel  h-panel-no-border">
          <div class="h-panel-bar">
            <span class="h-panel-title">网站数据</span>
          </div>
          <div class="h-panel-body">
            <ve-line :data="chartData" :settings="chartSettings"></ve-line>
            <!-- <ve-pie :data="chartData" :settings="chartSettings"></ve-pie> -->
          </div>
        </div>
      </Cell>
     <!--  <Cell width="12">
        <div class="h-panel  h-panel-no-border">
          <div class="h-panel-bar">
            <span class="h-panel-title">访问统计:开发中(PV100以上才能开通。)</span>
          </div>
          <div class="h-panel-body">
            <ve-line :data="chartData" :settings="chartSettings"></ve-line>
          </div>
        </div>
      </Cell> -->
      <Cell width="12">
        <div class="h-panel  h-panel-no-border">
          <div class="h-panel-bar">
            <span class="h-panel-title">快速导航</span>
          </div>
          <div class="h-panel-body">
            <ButtonGroup size="l">
              <Button
                icon="iconfont icon-icon_PDM"
                @click="goto('productCreate')"
                >新建产品</Button
              >
              <Button
                icon="iconfont icon-news_icon"
                @click="goto('articleCreate')"
                >新建文章</Button
              >
              <Button icon="iconfont icon-images" @click="goto('file')"
                >查看图片</Button
              >
              <Button icon="iconfont icon-liuyanguanli" @click="goto('mail')"
                >查看留言</Button
              >
            </ButtonGroup>
          </div>
        </div>
      </Cell>
    </Row>
  </div>
</template>

<script>
export default {
  name: "home",
  data() {
    this.chartSettings = {
      roseType: "radius",
      area: true
    };
    return {
      chartData: {
        columns: ["名称", "数量"],
        rows: []
      }
    };
  },
  methods: {
    goto(name) {
      this.$router.push(`/${name}`);
    },
    async getCount() {
      let res = await this.$get("/api/site/webcount");
      if (res && res.code === 200) {
        let data = res.data;
        this.chartData.rows = data;
      } else {
        this.$Message.error(res.message);
      }
    },
    getBiduApi() {
      this.$interfaceGet(
        "https://api.baidu.com/json/tongji/v1/ReportService/getData"
      );
    }
  },
  mounted() {
    this.getCount();
  }
};
</script>
<style lang="less" scoped>
.title {
  text-align: center;
  font-size: 18px;
  border-bottom: 1px solid #333;
  padding-bottom: 0;
  margin-bottom: 10px;
}
</style>